<html>
<head><meta charset="utf-8"><title>harness = false · miri · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/index.html">miri</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/harness.20.3D.20false.html">harness = false</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="236802101"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/harness%20%3D%20false/near/236802101" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> hyd-dev <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/harness.20.3D.20false.html#236802101">(Apr 30 2021 at 08:25)</a>:</h4>
<p>Is there a reason that Miri <code>tests/compiletest.rs</code> is using <code>#![feature(custom_test_frameworks)]</code> and a <code>test_runner()</code> function that receives no <code>#[test_case]</code> instead of a <code>main()</code> function and <a href="https://doc.rust-lang.org/nightly/cargo/reference/cargo-targets.html#the-harness-field"><code>harness = false</code></a> in <code>Cargo.toml</code>?</p>
<p>There is a comment after that <code>#![feature]</code>:</p>
<blockquote>
<p>Custom test runner, to avoid libtest being wrapped around compiletest which wraps libtest.</p>
</blockquote>
<p>I think setting <code>harness = false</code> is sufficient to prevent libtest from being used, and IMO it's better since <code>main()</code> doesn't need a dummy <code>_tests: &amp;[&amp;()]</code> parameter and I guess <code>harness = false</code> is designed for the case where you don't need the test harness.<br>
(Looking at the git blame, it seems added in <a href="https://github.com/rust-lang/miri/issues/515">miri#515</a> in 2018. I don't know if Cargo supported <code>harness = false</code> at that time.)</p>
<p>Happy to <a href="https://github.com/hyd-dev/miri/tree/harness-false">(verify carefully <code>harness = false</code> works well and) submit a PR</a> if this is desirable.</p>



<a name="236957365"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/harness%20%3D%20false/near/236957365" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/harness.20.3D.20false.html#236957365">(May 01 2021 at 10:47)</a>:</h4>
<blockquote>
<p>Is there a reason that Miri tests/compiletest.rs is using #![feature(custom_test_frameworks)] and a test_runner() function that receives no #[test_case] instead of a main() function and harness = false in Cargo.toml?</p>
</blockquote>
<p>The reason is "I didn't know that <code>harness=false</code> exists" :D</p>



<a name="236957409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/269128-miri/topic/harness%20%3D%20false/near/236957409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/269128-miri/topic/harness.20.3D.20false.html#236957409">(May 01 2021 at 10:47)</a>:</h4>
<p>So yes please submit a PR :)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>